/// @author Alberto Franco
/// @date   23-05-2011
/// @file   func_passing.go
/// @brief  Contains an experiment for pi-calculus capabilites of Go.
///         In this program function passing is implemented 
package picalculus

import (
    "fmt"
)

/// Program entry point
func FuncPassing_Main() {
    var funcChannel chan func(int32)
    var callback func(int32)
    
    funcChannel = make (chan func(int32))
    go support(funcChannel)
    
    callback = <- funcChannel
    callback(32) ///< "Print 32" is the output
}

/// This goroutine sends a function into the channel 
func support(channel chan func(int32)) {
    channel <- sendingFunction
}

/// This func simply print the given integer
func sendingFunction(a int32) {
    fmt.Println("Print", a)
}
